package com.example.papercutting.ui;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Toast;

//import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;

import com.example.papercutting.R;

public class SelectionActivity extends AppCompatActivity {

    private String selectedPaperType = ""; // 保存选中的纸张类型

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_selection);

        // 获取视图引用
        ImageButton leftArrow = findViewById(R.id.left_arrow);
        ImageButton rightArrow = findViewById(R.id.right_arrow);
        LinearLayout squarePaper = findViewById(R.id.square_paper);
        LinearLayout diamondPaper = findViewById(R.id.diamond_paper);
        LinearLayout circlePaper = findViewById(R.id.circle_paper);

        // 左箭头点击事件
        leftArrow.setOnClickListener(v -> {
            // 切换到上一页面逻辑
            Intent intent = new Intent(SelectionActivity.this, MainActivity.class);
            startActivity(intent);
            Toast.makeText(this, "上一页面", Toast.LENGTH_SHORT).show();
        });

        // 右箭头点击事件
        rightArrow.setOnClickListener(v -> {
            // 切换到下一页面逻辑
            Intent intent = new Intent(SelectionActivity.this, ColorActivity.class);
            intent.putExtra("selectedPaperType", selectedPaperType); // 传递纸张类型
            startActivity(intent);
            Toast.makeText(this, "当前纸张类型: " + selectedPaperType, Toast.LENGTH_SHORT).show();
        });

        // 正方形纸张点击事件
        squarePaper.setOnClickListener(v -> {
            selectedPaperType = "square";
            Toast.makeText(this, "选择: 正方形纸张", Toast.LENGTH_SHORT).show();
        });

        // 八边形纸张点击事件
        diamondPaper.setOnClickListener(v -> {
            selectedPaperType = "octagon";
            Toast.makeText(this, "选择: 八边形纸张", Toast.LENGTH_SHORT).show();
        });

        // 圆形纸张点击事件
        circlePaper.setOnClickListener(v -> {
            selectedPaperType = "circle";
            Toast.makeText(this, "选择: 圆形纸张", Toast.LENGTH_SHORT).show();
        });
    }
}


